package com.baturu.vin.hyundai.dal.dao;

import com.baturu.vin.dto.superEPC.SEPCGroupDTO;
import com.baturu.vin.hyundai.dal.entity.SEPCHyundaiSubGroupEntity;
import com.baturu.vin.hyundai.dto.HyundaiExtendDTO;
import com.baturu.vin.hyundai.dto.HyundaiKiaVehicleDTO;
import com.baturu.vin.hyundai.dto.KiaPartsDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: chenjiahao
 * @Time: 2019/7/8
 */
public interface HyundaiGroupDAO {

    @Select({"SELECT main_group FROM hyundai_main_group where status =1 and lang = #{lang} order by id"})
    List<SEPCGroupDTO> queryMainGroup(@Param("lang") String lang);

    @Select({"SELECT distinct groupName ,groupCode ,finalPartsImageUrl imageUrl,imgX,imgY ",
            "FROM hyundai_parts_ljd",
            "WHERE classify = #{mainGroup}",
            "AND year= #{dto.year}",
            "AND naif= #{dto.naif}",
            "AND micd= #{dto.micd}",
            "AND ocn= #{dto.ocn}",
            "AND ver= #{dto.ver}",
    })
    List<SEPCHyundaiSubGroupEntity> queryKiaSubGroup(@Param("dto") HyundaiExtendDTO hyundaiExtendDTO, @Param("mainGroup") String mainGroup);

    @Select({"SELECT distinct groupName ,groupCode ,finalPartsImageUrl imageUrl,imgX,imgY ",
            "FROM hyundai_parts_ljd_en",
            "WHERE classify = #{mainGroup}",
            "AND year= #{dto.year}",
            "AND naif= #{dto.naif}",
            "AND micd= #{dto.micd}",
            "AND ocn= #{dto.ocn}",
            "AND ver= #{dto.ver}",
    })
    List<SEPCHyundaiSubGroupEntity> queryKiaSubGroupEn(@Param("dto") HyundaiExtendDTO hyundaiExtendDTO, @Param("mainGroup") String mainGroup);

    @Select({"SELECT distinct groupName,classify,crnm,bpno,startTime,endTime,dealFinalPartsNote finalPartsNote,groupNumber,groupCode,finalPartsImageUrl,dealVehicleCode vehicleCode,imgX,imgY ",
            "FROM hyundai_parts",
            "WHERE classify = #{mainGroup}",
            "AND bpno= #{vin.bpno}",
            "AND startTime <= #{vin.makeDate}",
            "AND endTime >= #{vin.makeDate}",
    })
    List<KiaPartsDTO> queryHyundaiPartsBySubGroup(@Param("vin") HyundaiKiaVehicleDTO hyundaiKiaVehicleDTO, @Param("mainGroup") String mainGroup);

    @Select({"SELECT distinct groupName,classify,crnm,bpno,startTime,endTime,dealFinalPartsNote finalPartsNote,groupNumber,groupCode,finalPartsImageUrl,dealVehicleCode vehicleCode,imgX,imgY ",
            "FROM hyundai_parts_en",
            "WHERE classify = #{mainGroup}",
            "AND bpno= #{vin.bpno}",
            "AND startTime <= #{vin.makeDate}",
            "AND endTime >= #{vin.makeDate}",
    })
    List<KiaPartsDTO> queryHyundaiPartsBySubGroupEn(@Param("vin") HyundaiKiaVehicleDTO hyundaiKiaVehicleDTO, @Param("mainGroup") String mainGroup);
}
